<?php
namespace Admin\Controller;
use Think\Controller;
class PostController extends BaseController {
   public function postlist(){
        $videosModel=M('post'); //实例化模型对象 user 表名
		$videos=$videosModel->order('post_id desc')->join("user on post.user_id=user.user_id")->select(); //查询
		$this->videos=$videos; //volist name
		$this->display();
}
 public function delpost(){
        // dump($_GET);
        $videoModel=M('post');
        $vid=$_GET['vid'];
        var_dump($vid);
        $res=$videoModel->where("post_id=$vid")->find();
        //var_dump($res);
        $photoPath=realpath("./Public/Uploads/postpicture".$res['photo']);
        unlink($photoPath);
        if ($videoModel->where("post_id=$vid")->delete()) {
        	$this->success('删除成功');
        }else{
        	$this->error('删除失败');
        }

    }

}